package com.itheima;

import java.util.Scanner;

/**
 * 2025/3/29 9:34
 * 简单计算器
 */
public class LoopPractice1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        //提示用户输入2个数字和1个操作符
        System.out.println("请输入第1个数字：");
        double num1 = scanner.nextDouble();
        System.out.println("请输入第2个数字：");
        double num2 = scanner.nextDouble();
        System.out.println("请输入操作符：");
        String operation = scanner.next();

        switch(operation){
            case "+":
                System.out.println(num1+num2);
                break;
            case "-":
                System.out.println(num1-num2);
                break;
            case "*":
                System.out.println(num1*num2);
                break;
            case "/":
                System.out.println(num1/num2);
                break;
            default:
                System.out.println("输入的操作符有误！");
        }
    }
}
